<template>
  <div class="app-container">
    <el-table :data="taskList">
      <el-table-column label="序号" width="50" align="center">
        <template #default="scope">
          <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
        </template>
      </el-table-column>
      <el-table-column label="开始节点名称" align="center" prop="nodeName" :show-overflow-tooltip="true"/>
      <el-table-column label="结束节点名称" align="center" prop="targetNodeName" :show-overflow-tooltip="true"/>
      <el-table-column label="审批人" align="center" prop="approver" :show-overflow-tooltip="true"/>
      <el-table-column label="流程状态" align="center" prop="flowStatus" :show-overflow-tooltip="true">
        <template #default="scope">
          <dict-tag :options="flow_status" :value="scope.row.flowStatus"/>
        </template>
      </el-table-column>
      <el-table-column label="审批意见" align="center" prop="message" :show-overflow-tooltip="true"/>
      <el-table-column label="创建时间" align="center" prop="createTime" width="160" :show-overflow-tooltip="true">
        <template #default="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script setup name="DoneList">

import { doneList } from '@/api/flow/execute'
import {ref} from "vue";

const { proxy } = getCurrentInstance();
const { flow_status } = proxy.useDict('flow_status');
const instanceId = ref('');
const taskList = ref([]);
const data = reactive({
  queryParams: {
    pageNum: 1,
    pageSize: 10,
  }
});

const { queryParams } = toRefs(data);

function getList() {
  instanceId.value = proxy.$route.params && proxy.$route.params.instanceId;
  doneList(instanceId.value).then(response => {
    taskList.value = response.data;
  });
}

getList();
</script>
